<?php
if( !defined( '_VALID_MOS' ) && !defined( '_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' ); 
/**
*
* @version $Id: get_payment_method.tpl.php 1140 2008-01-09 20:44:35Z soeren_nb $
* @package VirtueMart
* @subpackage templates
* @copyright Copyright (C) 2007 Soeren Eberhardt. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* VirtueMart is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details.
*
* http://virtuemart.net
*/
if($_SESSION["cart"]["idx"] == 0) {
	echo "<script type='text/javascript'>window.location='index.php'</script>";
}


include_once( CLASSPATH . "ps_product.php");

$ps_product = new ps_product;

$cart = $_SESSION["cart"];
$count = (int) $_SESSION["cart"]["idx"];
//echo $count;
$db =& JFactory::getDBO();
$subtotal = 0;

$temp = explode("%7C",JRequest::getVar("shipping_rate_id",""));
$shipping_price = @$temp[3];

$ship_to_info_id = JRequest::getVar("ship_to_info_id","");


$q = "SELECT * FROM #__vm_category WHERE `category_publish` = 'Y'";
$mydb = JFactory::getDBO();
$mydb->setQuery($q);
$category = $mydb->loadObjectList();
$category_id = @JRequest::getInt("category_id",$category[0]->category_id);

$q = "SELECT * FROM #__content c LEFT JOIN #__jf_content jf ON c.`id` = jf.`reference_id` WHERE jf.`reference_table` = 'content' AND jf.`reference_id` = '50'";
$db->setQuery($q);
$term = $db->loadObjectList();
/*echo "<pre>";
var_dump($term);
echo "</pre>";*/
$lg = &JFactory::getLanguage();
$my_lang = $lg->get('backwardlang');
$en = "";
if($my_lang=="english") $en = "en/";

?>
<script type="text/javascript">
	jQuery(document).ready(function(){
		jQuery("#ha-submit").click(function(){
			if(jQuery('#ha-agree-term').is(":checked")==false){
				//alert('agree plz');
				$("#alert").html("<?php echo $VM_LANG->_('HA_TERM_AGREE'); ?>");
				$('#backoverlay').show();
				$('#show_popup').show();
			}
			else{
				jQuery("#checkoutForm").submit();
			}
		});
		jQuery('#myModal1').draggable();
	});
</script>
<!-- container -->
<div class="containerUnder">
	<div class="cartLeft">
		<div class="mainTitle"><?php echo $VM_LANG->_('HA_SHOPPING_CART'); ?></div>
		<ul class="cartCategory">
			<?php 
				for($i=0;$i<count($category);$i++){
					if($category_id != $category[$i]->category_id ){
						echo "<li><a href=\"index.php?option=com_virtuemart&page=shop.list&category_id=".$category[$i]->category_id."&Itemid=".$Itemid."\" class=\"cartCategory\">".$category[$i]->category_name."</a></li>";
					}else{
						echo "<li><a id=\"catSelect\" href=\"index.php?option=com_virtuemart&page=shop.list&category_id=".$category[$i]->category_id."\" class=\"cartCategory\">".$category[$i]->category_name."</a></li>";
					}
				}
			?>
		</ul>
	</div>
	<div class="cartRight">
		<form id="checkoutForm" method="post" action="index.php?option=com_virtuemart&page=checkout.quickpay">
		<div class="step1">
			<ul>
				<li><p><span>1</span><?php echo $VM_LANG->_('HA_STEP_1'); ?></p></li>
				<li><p><span>2</span><?php echo $VM_LANG->_('HA_STEP_2'); ?></p></li>
				<li><p><span>3</span><?php echo $VM_LANG->_('HA_STEP_3'); ?></p></li>
				<li class="select-step"><p><span>4</span><?php echo $VM_LANG->_('HA_STEP_4'); ?></p></li>
			</ul>
		</div>

		<div class="cartHeader">
			<div class="cartHeaderNote">&nbsp;</div>
			<div class="cartHeaderProduce"><?php echo $VM_LANG->_('HA_PRODUCT_LB'); ?></div>
			<div class="cartHeaderSize"><?php echo $VM_LANG->_('HA_SIZE_LB'); ?></div>
			<div class="cartHeaderQty"><?php echo $VM_LANG->_('HA_QTY_LB'); ?></div>
			<div class="cartHeaderPrice"><?php echo $VM_LANG->_('HA_PRICE'); ?></div>
			<div class="cartHeaderTotal"><?php echo $VM_LANG->_('HA_TOTAL'); ?></div>
			<div class="clr"></div>
		</div>
		<?php 
			for($i=0;$i<$count;$i++){
			$product = ps_product::get_product_with_id($cart[$i]["product_id"]);
			$subtotal += (float)$product->record[0]->product_price * (int) $cart[$i]["quantity"] ;
			//echo $i." :".$subtotal." Quantity : ".$cart[$i]["quantity"]."<br />";
		?>
				<div class="cartRow">
					<div class="cartHeaderNote">
						&nbsp;
					</div>
					<div class="cartHeaderProduce">
						<img width="70" height="52" src="<?php echo JURI::base(); ?>components/com_virtuemart/shop_image/product/<?php echo $product->record[0]->product_full_image; ?>" alt=""/>
						<span><?php echo $product->record[0]->product_name; ?></span>
					</div>
					<div class="cartHeaderSize"><h3><?php 
						$ha_size = explode(":",$cart[$i]["description"]);
						echo $ha_size[1];
					
					?></h3></div>
					<div class="cartHeaderQty">
						<h3><?php echo $cart[$i]["quantity"] ?></h3>
					</div>
					<div class="cartHeaderPrice"><h3><?php echo $CURRENCY_DISPLAY->getFullValue($product->record[0]->product_price);?></h3></div>
					<div class="cartHeaderTotal"><h3><?php echo $CURRENCY_DISPLAY->getFullValue($product->record[0]->product_price * $cart[$i]["quantity"]);?></h3></div>
					<div class="clr"></div>
				</div>
		<?php 
			} 
		?>
		<div class="cartUnder">
			<div class="cartUnderPrice"><?php echo $CURRENCY_DISPLAY->getFullValue($subtotal); ?></div>
			<div class="cartUnderPriceTitle"><?php echo $VM_LANG->_('HA_SUBTOTAL'); ?></div>
			<div class="clr"></div>
		</div>
		<div class="cartUnder">
			<div class="cartUnderPrice"><?php echo $CURRENCY_DISPLAY->getFullValue($shipping_price); ?></div>
			<div class="cartUnderPriceTitle"><?php echo $VM_LANG->_('HA_SHIPPING_FEE'); ?></div>
			<div class="clr"></div>
		</div>

		<div class="cartUnder">
			<div class="cartUnderPrice"><span><?php echo $CURRENCY_DISPLAY->getFullValue($shipping_price + $subtotal); ?></span></div>
			<div class="cartUnderPriceTitle"><span><?php echo $VM_LANG->_('HA_TOTAL'); ?></span></div>
			<div class="clr"></div>
		</div>
		<div class="cartButton">
			<div class="cartButtonLeft" style="padding-top:20px!important;">
				<input type="checkbox" id='ha-agree-term' /> <a data-reveal-id="myModal1" class="link-btn"  href="#"><u><?php echo $VM_LANG->_('HA_BRUUN_AGREE_TERM_LB'); ?></u></a><br /><br /><br />
				<img src="<?php echo JURI::base(); ?>templates/rhuk_milkyway/images/back_ico.jpg" alt=""/><a style="cursor:pointer;" onclick="window.history.back();"> <?php echo $VM_LANG->_('HA_BACK_BTN'); ?></a>
				
				<div id="myModal1" class="reveal-modal">
					<?php 
						if($en != ""){
							echo $term[3]->introtext.$term[3]->fulltext;
						}else
						{
							echo $term[3]->value;
						}
					?>
					<!--<p>Welcome to the Dummy Text Generator!
						This handy tool helps you create dummy text for all your layout needs.
						We are gradually adding new functionality and we welcome your suggestions and feedback.
						Please feel free to send us any additional dummy texts.</p>
					<p>Welcome to the Dummy Text Generator!
						This handy tool helps you create dummy text for all your layout needs.
						We are gradually adding new functionality and we welcome your suggestions and feedback.
						Please feel free to send us any additional dummy texts.</p>
					<p>Nam quam nunc, blandit vel, luctus pulvinar, hendrerit id, lorem. Maecenas nec odio et ante tincidunt tempus. Donec vitae sapien ut libero venenatis faucibus. Nullam quis ante. Etiam sit amet orci eget eros faucibus tincidunt. Duis leo. Sed fringilla mauris sit amet nibh. Donec sodales sagittis magna. Sed consequat, leo eget bibendum sodales, augue velit </p>
					-->
					 <a class="close-reveal-modal">&#215;</a>
				</div>
			</div>

			<div class="cartButtonRight"><a id="ha-submit" class="btn btn-til" href="#" ><span><?php echo $VM_LANG->_('HA_TIL_BETALING'); ?></span></a></div>
			<div class="clr space20"></div>
			<!--<div>
				<a href="#"><img src="<?php echo JURI::base(); ?>templates/rhuk_milkyway/images/footer_banner.jpg" alt=""/></a>
			</div>-->

		</div>
		<div class="cartInfo">
			<div class="cartInfoTxt">Pay by Dankort, Visa, Visa Electron, Mastercard og Maestro</div>
			<img src="<?php echo JURI::base(); ?>templates/rhuk_milkyway/images/cart_master1.png" alt=""/>
			<img src="<?php echo JURI::base(); ?>templates/rhuk_milkyway/images/cart_master.png" alt=""/>
			<img src="<?php echo JURI::base(); ?>templates/rhuk_milkyway/images/cart_visa1.png" alt=""/>
			<img src="<?php echo JURI::base(); ?>templates/rhuk_milkyway/images/cart_visa.png" alt=""/>
			<img src="<?php echo JURI::base(); ?>templates/rhuk_milkyway/images/cart_DK.png" alt=""/>
			<div class="clr"></div>
		</div>
			<input type="hidden" name="checkout_last_step" value="4" />
			<input type="hidden" name="checkout_this_step[]" value="CHECK_OUT_GET_FINAL_CONFIRMATION" />
			<input type="hidden" name="customer_note" value="" />
			<input type="hidden" name="formSubmit" value="Confirm Order" />
			<input type="hidden" name="func" value="checkoutProcess" />
			<input type="hidden" name="payment_method_id" value="20" />
			<input type="hidden" id="hidden-userid" name="user_id" value="<?php echo $_SESSION["auth"]["user_id"]; ?>" />
			<input type="hidden" id="hidden-ship_to_info_id" name="ship_to_info_id" value="<?php echo $ship_to_info_id; ?>" />
			<input type="hidden" name="shipping_rate_id" value="<?php echo JRequest::getVar("shipping_rate_id","");?>" />
			<input type="hidden" name="zone_qty" value="1" />
			<input type="hidden" id="hidden-total" name="total" value="<?php echo $shipping_price + $subtotal; ?>" />
			<input type="hidden" id="hidden-subtotal" name="sub_total" value="<?php echo $subtotal; ?>" />
		</form>
	</div>
	
	<div class="clr"></div>
</div>
<!-- end container -->

			